import React,{useState} from 'react'
import {useSelector,useDispatch} from "react-redux"
import {Table,Button} from "antd"
import {delList} from "../action/listAction"

export default function Mine(props:any) {

    const list:any = useSelector((state:any) => state.listInfo.list);
    const dispatch = useDispatch();
    const [header, setHeader] = useState([
        {
            title: '姓名',
            dataIndex: 'name',
            key: 'name',
        },
        {
            title: '年龄',
            dataIndex: 'age',
            key: 'age',
        },
        {
            title: '住址',
            dataIndex: 'address',
            key: 'address',
        },
        {
            title: 'Action',
            key: 'action',
            render: (text: any, record: any) => (
                <Button type="primary" onClick={()=>{
                    dispatch(delList(record.id));
                }}>
                  删除
                </Button>
            ),
        },
    ]);
    return (
        <div>
            个人中心
            <Table dataSource={list} columns={header}></Table>
        </div>
    )
}
